<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>上传作品 - <?php echo $cfg_webname; ?></title>
<link href="templets/style/css/reset.css" rel="stylesheet" type="text/css">
<link href="templets/style/css/member.css" rel="stylesheet" type="text/css">
<link href="templets/style/up.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="templets/js/j.js"></script>
<script type="text/javascript" src="templets/js/load.js"></script>
<script type="text/javascript" src="templets/js/leftmenu.js"></script>
<script type="text/javascript" language='javascript' src="templets/js/main.js"></script>
<script type="text/javascript" src="templets/js/checkSubmit.js"></script>
<script type="text/javascript" src="upface/ajaxupload.3.5.js"></script>
<script type="text/javascript" charset="utf-8" src="../include/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../include/ueditor/ueditor.all.js"></script>
<link rel="stylesheet" type="text/css" href="../include/ueditor/themes/default/css/ueditor.css"/>
<link rel="stylesheet" type="text/css" href="webupload/webuploader.css" />
<link rel="stylesheet" type="text/css" href="webupload/style.css" />
<link rel="stylesheet" type="text/css" href="bootstrap/css/css.css" />
<style>
        h6 dt{width:100px !important;}
        #wrapper dt {  margin-left: 0; }
        .uploader-container dt {  margin-left: 0; }
        #wrapper li { padding-left: 0 }
        #lit-view{display: none}
        #lit-view img{max-height: 100px;max-width: 200px;}
        #litpicPicker{line-height: normal !important;}
        #zipPicker{line-height: normal !important;}
        .progress-bar{background-color: #3F92D6;height:3px;border: 1px #3F92D6 solid;}
        .progress{width:100%;background-color: #ccc;}
        #softurl5{margin-bottom: 10px;}
        /*#uploadLitpic{position: absolute; opacity: 0; filter:Alpha(opacity=0);}*/
        .tips, .dtip {
            padding: 15px;
            margin: 5px auto 15px auto;
            color: #F30;
            font-family: Tahoma,Geneva,sans-serif;
            background: #ffd;
            border: 1px solid #EDEDBE;
            border-radius: 5px;
        }
        .tips i{  display: block;
            width: 15px;
            height: 15px;
            float: left;
            margin-right: 10px;
            overflow: hidden;}
        #tips12,#tips13{position: absolute;display:none;text-align: left;z-index:999;color:#7f7e7d}
        .tip1,.tip2{cursor: pointer}
	
    </style>
</head>
<body>

<!--head-->
<?php include(DEDEMEMBER. "/templets/head.htm"); ?>


<div class="main">

<?php include(DEDEMEMBER."/templets/menu.php"); ?>

<div class="main_right">

    <form class="mTB10 mR10 mL10" name="addcontent" action="soft_edit.php" method="post" enctype="multipart/form-data" onsubmit="return checkSubmit();">
      <input type="hidden" name="dopost" value="newsave" />
	  <input type="hidden" name="aid" value="<?php echo $row['id']; ?>" />
      <input type="hidden" name="idhash" value="<?php echo md5($row['id'].$cfg_cookie_encode); ?>" />
      <input type="hidden" name="channelid" value="<?php echo $row['channel']; ?>" />
      <input type="hidden" id="litpics" name="addlitpic" value="<?php echo $row['litpic']; ?>" />
      <input type="hidden" name="sortrank" value="<?php echo $row['sortrank']; ?>" />
	  <input type='hidden' name='dede_addonfields' value="mbcx,select;mblx,select;mbhy,select;mbys,select;mbbm,select;version,text;goods,radio;pan_baidu,text;pan_baidu_mima,text;dows,int;stows,int">
      <!-- <input type="hidden" id="previewurl" name="previewurl" value="" /> -->
      <div id="mainCp">
        <div class="postForm upsucai-new">
		<dl>
          <dt>栏目类别 <small>*</small></dt>
          <dd> <?php
   			$typeOptions = GetOptionList($row["typeid"],$row["channel"]);
    		echo "<select name='typeid' size='1'>\r\n";
   			echo $typeOptions;
   			echo "</select>";
		  ?>
		  </dd>
        </dl>
        

       <dl>
          <dt>素材标题 <small>*</small></dt>
          <dd><input name="title" type="text" id="title" maxlength="100" autocomplete="off" class="intxt" placeholder="准确，有吸引力的标题非常重要" value="<?php echo $row['title'];?>"/></dd>
       </dl>
		<dl>
			<dt>百度网盘 <small>*</small></dt>
			<dd><input name="pan_baidu" type="text" id="bdwp" maxlength="100" autocomplete="off" class="intxt" value="<?php echo $row['pan_baidu'];?>"/></dd>
		</dl>
		<dl>
			<dt>网盘密码 <small>*</small></dt>
			<dd><input name="pan_baidu_mima" type="text" id="wpmm" maxlength="100" autocomplete="off" class="intxt" value="<?php echo $row['pan_baidu_mima'];?>" /></dd>
		</dl>
       <dl style="display: none">
          <dt>模板售价 <small>*</small></dt>
          <dd><input name="needmoney" type="text" class="intxt needmoney"  autocomplete="off" value="<?php echo $addRow['needmoney'];?>"/>金币，免费请填写0</dd>
       </dl>
       <div class="up-add">
         
            <dt>主图图片 <small>*</small></dt>
            <button id="upload_button" type="button"><i id="upmsg">选择文件 (预览图大小限制2M以内)<font color="red"><?php if($row['litpic']!='') echo '已上传' ?></font></i></button>
			<img src="<?php echo $row['litpic'];?>" id="litpic"  width="200" style="margin-left:135px;margin-top:5px;">
         
         <p id="loadimg"><img src="<?php echo $cfg_skin; ?>/images/loading.gif" /></p>
       </div>
	   <dl style="display: none">
			<?php $mbcx=array("织梦","帝国","Discuz","wordpress","ecshop","phpcms","其它");?>
          <dt>系统品牌 <small>*</small></dt>
          <dd>
		   <select name="mbcx" id="sc_chicun_select" style="width:561px;">
            <?php foreach($mbcx as $key=>$v){?>
			<option value='<?php echo $v;?>' <?php if($addRow['mbcx']==$v) echo 'selected';?>><?php echo $v;?></option>
			<?php }?>	
         </select>
		 </dd>
       </dl>
	   <dl style="display: none">
		  <?php $mblx=array("纯PC模板","纯移动端模板","PC端+单独移动端","自适应");?>
          <dt>模板类型 <small>*</small></dt>
          <dd>
		  <select name="mblx" id="sc_chicun_select" style="width:561px;">
            <?php foreach($mblx as $key=>$v){?>
			<option value='<?php echo $v;?>' <?php if($addRow['mblx']==$v) echo 'selected';?>><?php echo $v;?></option>
			<?php }?>
         </select>
		 </dd>
       </dl>
	   <dl style="display: none">
		  <?php $mbhy=array("网络公司","文章资讯","淘客返利","图片素材","软件下载","电影音乐","游戏动漫","威客任务","购物商城","o2o系统","建筑装饰","建材家具","机械设备","电子数码","汽车服务","医院医疗","教育培训","广告设计","母婴家政","餐饮酒店","旅游婚庆","金融借贷","房产租售","通用其他");?>
          <dt>所属行业 <small>*</small></dt>
         <dd>
		 <select name="mbhy" id="sc_chicun_select" style="width:561px;">
            <?php foreach($mbhy as $key=>$v){?>
			<option value='<?php echo $v;?>' <?php if($addRow['mbhy']==$v) echo 'selected';?>><?php echo $v;?></option>
			<?php }?>	
         </select>
		 </dd>
       </dl>
	   <dl style="display: none">
		<?php $mbys=array("红色","橙色","黄色","绿色","粉色","蓝色","紫色","黑色","灰色","白色","咖啡色","多色");?>
          <dt>颜色分类 <small>*</small></dt>
          
		  <dd>
			<select name="mbys" id="sc_chicun_select" style="width:561px;">
            <?php foreach($mbys as $key=>$v){?>
			<option value='<?php echo $v;?>' <?php if($addRow['mbys']==$v) echo 'selected';?>><?php echo $v;?></option>
			<?php }?>
			</select>
			</dd>
       </dl>
	   <dl style="display: none">
			<?php $mbbm=array("gbk","utf8");?>
          <dt>编码 <small>*</small></dt>
		  <dd>
            <select name="mbbm" id="sc_chicun_select" style="width:561px;">
            <?php foreach($mbbm as $key=>$v){?>
			<option value='<?php echo $v;?>' <?php if($addRow['mbbm']==$v) echo 'selected';?>><?php echo $v;?></option>
			<?php }?>
			</select>
		   </dd>
       </dl>
	   <dl style="display: none">
		  <dt>文件版本</dt>
		  <dd>
		  <input type='text' name='version' id='version' style='width:250px'  class='intxt'placeholder="如：dedecms5.7" value='<?php echo $addRow['version'];?>' />
		  </dd>
		</dl>
		<dl style="display: none">
		  <dt>文件大小</dt>
		  <dd>
		  <input type='text' name='softsize' id='softsize' style='width:250px'  class='intxt' placeholder="如：59.8mb"  value='<?php echo $addRow['softsize'];?>' />MB
		  </dd>
		  
		</dl>

	   
		
		 <dl>
			  <dt>详情图片<small>*</small></dt>
				<dd style="width:725px;">
								<div class="pics"> 
									<ul class="clearfix" id="ul_pics" style="margin-bottom:35px;margin-top:-40px;"> 
									
									<?php
									 $imgurls=$addRow['imgurls'];
									   $j = 1;
									   if($imgurls!=""){
										 $dtp = new DedeTagParse();
										 $dtp->LoadSource($imgurls);
										 if(is_array($dtp->CTags))
										 {
											 foreach($dtp->CTags as $ctag)
											 {
												 if($ctag->GetName()=="img")
												 {
													 $bigimg = trim($ctag->GetInnerText());
													 if($ctag->GetAtt('ddimg') != $bigimg && $ctag->GetAtt('ddimg')!='')
													 {
															$litimg = $ctag->GetAtt('ddimg');
															$litimg=str_replace("‘","",$litimg);
													 }
													 else
													 {
														 $litimg = 'swfupload.php?dopost=ddimg&img='.$bigimg;
													 }
													 $litimg=str_replace("-lp","",$litimg);
													 $txt=str_replace("‘","",$ctag->GetAtt('text'));
													 $fhtml = '';
													 $fhtml .= "<li class='item'>";
													 $fhtml .= "<div class='p-pic'><a href='{$litimg}' target='_blank'><img src='{$litimg}' alt='{$litimg}'></a></div>";
													 $fhtml .= "<a class='picture_delete'>×</a>";
													 $fhtml .= "<input type='hidden' name='bigfile_info[]' id='pic' value='{$litimg}'>";
													 $fhtml .= "<input type='text' name='bigfile_name[]' value='".$txt."'  placeholder='图片说明'/>";
													 $fhtml .= "</li>";
													 echo $fhtml;
													 $j++;
												 }
											 }
										 }
										 $dtp->Clear();
									   }
									   ?>
										<li class="item"> <a class="picture_add" onclick="show_pics_box()">+加图</a> </li> 
									</ul> 
								</div> 
								</dd>
			
		
			<div class="modal fade" id="modal_upload"> 
				<div class="modal-dialog"> 
					<div class="modal-content"> 
						<div class="modal-header"> 
							<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> 
							<h4 class="modal-title">上传图片</h4> 
						</div> 
						<div class="modal-body"> 
							<div class="form-inline"> 
								<dt class="control-dt">网络图片</dt> 
								<input type="text" class="form-control" id="pic_url" style="margin:0 10px;width:300px" placeholder="请贴入网络图片地址" autocomplete="off" /> 
								<button type="button" class="btn btn-primary" onclick="getPicUrl()">提取</button> 
							</div> 
							<div class="form-inline clearfix" style="margin:15px 0 0"> 
								<dt class="control-dt" style="float:left">本地图片</dt> 
								<div id="photos_area" class="photos_area"> 
									<a class="cover_btn" id="cover_btn_big"><span>+</span></a> 
								</div> 
							</div> 
							<div class="controls preview-container"></div> 
						</div> 
						<div class="modal-footer"> 
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> 
							<button type="button" class="btn btn-primary" onclick="upload_complete()">上传</button> 
						</div> 
					</div> 
				</div> 
			</div> 
			<link rel="stylesheet" href="bootstrap/bootstrap/css/bootstrap.min.css" /> 
			<!-- jQuery文件。务必在bootstrap.min.js 之前引入 --> 
			<script src="bootstrap/jquery.js"></script> 
			<!-- 最新的 Bootstrap 核心 JavaScript 文件 --> 
			<script src="bootstrap/bootstrap/js/bootstrap.min.js"></script> 
			<script type="text/javascript" src="bootstrap/plupload/plupload.full.min.js"></script> 
			<script type="text/javascript" src="bootstrap/uploads.js"></script> 
		</dl>
	   
			

		
		<!--<?php if($cfg_localfile=='Y'){ ?>
		<dl>
		<div>
			<div style="float:left"><dt>模板下载地址</dt>
				<input type='text' name="softurl1" id="softurl1"  style='width:350px;border:1px solid #d8d8d8;padding:5px;height:40px;line-height:40px;'  class='intxt' placeholder="rar,zip格式" value='<?php echo $addRow['softurl1']; ?>' />
			</div>
			<div class="uploader-container"  style="float:left;">
                <div id="zipPicker"></div>
            </div>
            <div id="thelistzip" class="uploader-list" style="padding-top:45px;">
                <div id="" class="item">
                        <h4 class="info"></h4>
                 </div>
            </div>
		</div>	
		</dl>
	    <?php } ?>-->
		
       <dl>
          <dt>关键字<small>*</small></dt>
          <dd><textarea style="width:700px;border:1px solid #e4e4e4;height:100px;box-sizing:border-box;padding:5px;" name="tags" placeholder="多个词请用空格隔开，准确详细的关键词使素材更容易被搜索和下载"><?php echo $row['keywords'];?></textarea></dd>
       </dl>
       <dl>
          <dt>素材说明</dt>
          <dd style="margin-left:-65px;">
		  <textarea name="body" id="body" rows="8" cols="60"><?php echo $addRow["introduce"];?></textarea>
		  <script type="text/javascript">var ue = new baidu.editor.ui.Editor();ue.render("body");</script>
		  </dd>
       </dl>
       <?php
      	//管理员才显示此按钮
      	if($cfg_ml->isAdmin==1){
       ?>
       <p class="sc-radio">
          <label>是否精品 <small>*</small></label>
         <input type="radio" name="goods" class="np" value="1" <?php if($addRow['goods']==1) echo checked;?>>是
          <i><input type="radio" name="goods" class="np" value="0" <?php if($addRow['goods']==0) echo checked;?> >否</i>
       </p>
       <?php  }?>
       <?php
      if($safe_faq_send == '1'){
      	$faqkey = array_rand($safefaqs);
      ?>
      <dl class="cellBg">
            <dt>验证问题</dt>
            <dd><?php echo $safefaqs[$faqkey]['question'];?> (答案:<?php echo $safefaqs[$faqkey]['answer'];?>)<input class="intxt" name="safeanswer" type="text" id="safeanswer" size="25" style='width:250px;'/> 
                <input type="hidden" name="faqkey" value="<?php echo $faqkey;?>" />
			</dd>
       </dl>
       <?php
   		 }
      	//游客强制加验证码，会员则判断后台开关
      	if(preg_match("/3/",$safe_gdopen)){
      ?>
       <dl class="cellBg">
         <dt>验证码</dt>
         <dd>
		 <input name="vdcode" type="text" id="vdcode" maxlength="100" autocomplete="off" class="intxt" style='width:150px;text-transform:uppercase;' />
         <img src="../include/vdimgck.php" alt="看不清？点击更换" align="absmiddle" style="cursor:pointer" onclick="this.src=this.src+'?'" />
		 </dd>
		 </dl>
      <?php  }?>

          <div class="sub-pk">
             <input type="submit" class="sczp_button" value="立即修改">
          </div>
		  </dl>
       </div>
      </div>
	  
    </form>
	
</div>

</div>

    <script type="text/javascript" src="webupload/webuploader.js"></script>

	<script>
	//保留两位小数
	function formatFloat(src, pos)
		{
			return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
		}
    $(function(){
        uploaderZip = WebUploader.create({
            pick: {
                id: '#zipPicker',
                dt: '上传本地文件(最大50MB)',
                multiple:false,
				duplicate :true
            },
			
            formData: {
                "token":"<?php echo $upToken;?>",	
                
            },
            swf: 'webupload/Uploader.swf',
            server: 'http://up.qiniu.com/',
            accept: {
                title: 'Files',
                extensions: 'zip,rar,gzip',
                mimeTypes : '.zip,.rar,.gzip'
            },
            fileNumLimit: 3,
            auto:true,
            fileSingleSizeLimit: 500 * 1024 * 1024    // 50MB
        });
		
        uploaderZip.on('fileQueued', function( file ) {
            $('#thelistzip').append( '<div id="' + file.id + '" class="item">' +
                    '</div>' );
			filetype = file.ext;
			
			var key="";
			var now=new Date();
			key="<?php echo 'user/'.$cfg_ml->M_ID."/".date("Ymd").rand(10000,99999).'.';?>"+filetype;
			uploaderZip.options.formData.key = key;
        });

        uploaderZip.on( 'uploadSuccess', function( file ) {
            //$( '#'+file.id ).find('p.state').text('已上传');
        });

        uploaderZip.on( 'uploadError', function( file ,reason ) {
			uploaderZip.reset();
            alert('上传出错');	
        });


        uploaderZip.on( 'uploadComplete', function( file) {
            $( '#'+file.id ).find('.progress').fadeOut();
            //$(".item").hide();
        });

        uploaderZip.on( 'uploadAccept', function( file, data,response ) {
            if ( response.hasError ) {
                // 通过return false来告诉组件，此文件上传有错。
                return false;
            }
			console.log(file);
			filesize=formatFloat(file.total/1048756, 2);
			$("#softsize").val(filesize);
            $("#softurl1").val("<?php echo $cfg_qnurl?>"+data.key);

            return true;
        });
        uploaderZip.on('uploadProgress', function( file, percentage ) {
            var $li = $( '#'+file.id ),
                    $percent = $li.find('.progress .progress-bar');

            // 避免重复创建
            if ( !$percent.length ) {
                $percent = $('<div class="progress progress-striped active">' +
                        '<div class="progress-bar" role="progressbar" style="width: 0%">' +
                        '</div>' +
                        '</div>').appendTo( $li ).find('.progress-bar');
            }


            $percent.css( 'width', percentage * 100 + '%' );
        });
        uploaderZip.onError = function( code ) {
			
            if(code=="Q_EXCEED_NUM_LIMIT"){
                alert("超出最大文件数");
            }
            if(code=="F_DUPLICATE"){
                alert("文件重复");
            }
            if(code=="F_EXCEED_SIZE"){
                alert("文件体积不能高于50MB");
            }
        };


    });


</script>
<script>
$(function(){
$(".webuploader-pick").text("上传本地文件(最大50MB)");
})
</script>
<!--footer-->
<?php include(DEDEMEMBER. "/templets/footer.htm"); ?>

<script type="text/javascript">
$(document).ready(function(){
    ajaxUpload(
		'upload_button', 
        2048,  
        'upface/upload.php?form_name=userfile&file_size=2048&type=pic&mid=<?php echo $cfg_ml->M_ID;?>', 
        'userfile', 
        "$(\".img_div\").show();$(\"#litpics\").attr('value', obj.filename);$(\"#litpic\").attr('src', obj.filename);$(\"#is_upload\").val('1');document.getElementById(\"upmsg\").innerText=\"预览图上传成功\";", 
        'loadimg' 
    );

});
</script>
<script type="text/javascript" src="templets/js/ajaxaddup.js"></script>
<script>
	//左边导航
	var as = document.querySelectorAll('.left_menu a');
	var spans = document.querySelectorAll('.left_menu .icons');
	for(var i=0,len=as.length;i<len;i++){
		
		spans[i].clazz = spans[i].className;
		as[i].index = i;
		as[i].onmouseenter = mouseenterHandler;
		as[i].onmouseleave = mouseleaseHandler;
	}
	function mouseenterHandler(e){
		if(!/_h$/.test(spans[this.index].clazz)){
			spans[this.index].className = spans[this.index].clazz + '_h';
		}
	}
	function mouseleaseHandler(e){
		spans[this.index].className = spans[this.index].clazz;
	}
	

</script>

</body>
</html>